package com.ruoyi.shop.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.shop.mapper.ChartsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName ChartsController
 * @Description TODO
 * @Author zhangzongkai
 * @Date 2024年06月12日 10:58
 * @Version 1.0
 */
@RestController
@RequestMapping("/charts")
@CrossOrigin
public class ChartsController extends BaseController {
    @Autowired
    private ChartsMapper chartsMapper;
    @RequestMapping("/orderCountPie")
    public AjaxResult orderCountPie(){
        return success(chartsMapper.selectOrderCountPie());
    }
    @RequestMapping("/rescueCountPie")
    public AjaxResult rescueCountPie(){
        return success(chartsMapper.selectRescueCountPie());
    }
    @RequestMapping("/count")
    public AjaxResult count(){
        Map<String,Long> map = new HashMap<>();
        map.put("orderMoney",chartsMapper.selectOrderMoney());
        map.put("orderCount",chartsMapper.selectOrderCount());
        map.put("businessNum",chartsMapper.selectBusinessNumCount());
        map.put("userNum",chartsMapper.selectUserNumCount());
        return success(map);
    }
}
